<template>
  <div ref="echartDemo1" class="echartDemo1">
  </div>
</template>

<script>
export default {
  mounted() {
    this.initEchartDemo1();
  },
  methods: {
    // 初始化echart1
    initEchartDemo1() {
      console.log('e1', this.$refs.echartDemo1);
      let myChart = this.$echarts.init(this.$refs.echartDemo1);
      // 绘制图表
      myChart.setOption({
        // title: {
        //   text: 'ECharts 入门示例',
        // },
        color: '#f60', //柱子颜色
        tooltip: {},
        xAxis: {
          data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'],
        },
        yAxis: {},
        series: [
          {
            name: '销量',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20],
          },
        ],
        grid: {
          left: '5%',
          top: '10%',
          left: '5%',
          right: '5%',
          containLabel: true,
        },
      });
      myChart.resize({
        height: 180,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.echartDemo1 {
  height: 100%;
  width: 100%;
}
</style>